Skip to content

fix(desktop): discover nvm-managed Node in the App tool search - #3

Closed
xiaods wants to merge 10000 commits into
mainfrom
codex/desktop-nvm-node-search
Closed

xiaods wants to merge 10000 commits into
mainfrom
codex/desktop-nvm-node-search

Conversation

@xiaods

@xiaods xiaods commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Problem

On macOS, launching LoopX Desktop from Finder fails runtime preparation with:

安装程序退出(1);App 的启动环境未找到 Node.js。请启用受支持的 Node.js 后点击「修复当前版本」。

Diagnostics show node_found: false on a host whose only supported Node is
installed with nvm (~/.nvm/versions/node/v24.22.1/bin/node).

Finder/launchd never load a user's interactive shell profile, so the App
resolves tools from a bounded search path (runtime_search_path in
src-tauri/src/services.rs): $HOME/.local/bin, Homebrew, the keg-only
node@24/node@22 formulae, then the inherited PATH. nvm activates Node by
prepending $NVM_BIN to the interactive PATH, so that activation is invisible
to a GUI launch: the private installer ran
loopx doctor --deep --installation-only with no Node on PATH, the
typescript_effect_runtime_ready check failed, and install-local.sh exited 1.
The installed 2.3.0 binary contains the Homebrew entries but no .nvm string,
confirming the shipped search never considered nvm.

Reproduced locally with the App's own search path:

$ PATH="$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:...:/usr/bin:/bin"     loopx --format json doctor --deep --installation-only
"typescript_effect_runtime_ready": ok=false, "detected_node_version": null,
"diagnostic_code": "node_unavailable"          # exit 1

Fix

Resolve the same bounded nvm locations the Lark CLI resolver
(loopx/extensions/lark/cli_resolution.py) already uses, without running nvm
or sourcing any startup file:

  1. $NVM_BIN activated in the App's own environment (a terminal launch),
  2. the recorded default alias chain (default -> lts/* ->
    lts/krypton -> v24.22.1),
  3. the installed versions newest-first, behind the supported Homebrew
    runtimes so an outdated default cannot hide them.

The alias read stays inside $NVM_DIR/alias, is depth-bounded and rejects
non-normal path components, so a missing, cyclic or malformed chain just falls
through to installed-version discovery. The installer and the App-owned
services share this single search path, so the services started afterwards
also see the same Node.

Validation

  • cargo test --lib (206 passed): four new tests cover alias-chain resolution
    and escape rejection, NVM_BIN precedence, newest-first installed versions,
    PATH ordering/idempotency, and NVM_DIR/HOME root selection. The existing
    Finder tool-search test gained an ambient-NVM_BIN guard so an nvm-activated
    developer shell cannot break its fixed-position assertions.
  • cargo fmt --check and cargo clippy --all-targets -- -D warnings clean.
  • Windows cfg gating verified by compiling the added block with and without
    the unix cfg (rustc), so the Windows CI leg cannot regress.
  • python3 -m unittest discover -s tests/desktop (28 passed).
  • Real-path check with the installed App's private release: the same doctor
    command above returns ok=true, detected_node_version: 24.22.1 once the
    search path can reach nvm-managed Node.

Scope / remaining gaps

  • Hosts whose Node comes from another version manager (fnm, asdf, volta, n)
    still rely on $HOME/.local/bin, Homebrew or a terminal launch; nvm is the
    evidenced gap here and the fix stays bounded to it.
  • The shipped 2.3.0 binary is unaffected; this needs a new signed desktop
    build/release. Affected users can work around it today with
    ln -s ~/.nvm/versions/node/<version>/bin/node ~/.local/bin/node, which the
    current search path already honors.

loopx-agent and others added 30 commits November 18, 2026 09:05
…ark-worker-wake-request-attribution

Count benchmark worker quota guards in trajectory usage
The premerge public-boundary step sent video fixtures to the UTF-8 text
scan, which failed closed on them as unreadable. Route .mp4/.mov/.webm
to the existing visual-review hold, like images, but only when the file
carries the container header, so a text file renamed to a video suffix
is still scanned. The hold still blocks merge until reviewed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: maxliux5 <[email protected]>
The public-boundary scan treated JSX props such as token={token}, empty
query-parameter names such as 'token=', bare object member reads such as
authorization: req.headers.authorization and Python f-string lookups as
credential literals. Recognise these source shapes before quotes are
discarded. Quoted values, concatenations, URLs with a value and Bearer
headers still block, and every match on a line must be a reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: maxliux5 <[email protected]>
Enrich a failed route only when the raw Host selector permits an exact Codex binding. Preserve the original diagnostic on invalid selectors and keep the Inbox unchanged.

Signed-off-by: LoopX Agent <[email protected]>
…d-model-default-adoption

Honor machine model defaults when resuming legacy steward sessions
…witches

Switching A -> B -> C while A's send was still pending cleared B's unsent draft because the layout cleanup and autosave checked a component-wide boolean rather than the draft key being sent. Track the active send owner key (including new -> created thread migration) so leaving or editing other conversations keeps their drafts intact.

Signed-off-by: maxliux5 <[email protected]>
…e by attempt

Record synchronous sending state and a monotonic attempt owner before awaiting sendManagerTurn, blocking duplicate submissions while POST acceptance is pending and ignoring late acceptance or stream events from superseded attempts.

Signed-off-by: maxliux5 <[email protected]>
…eaders

Parse table and array-of-table headers with the shared key-path and whitespace helpers so valid headers such as '[mcp_servers.example] # comment' are discovered and replaced in place instead of appending duplicate tables.

Signed-off-by: maxliux5 <[email protected]>
… update-node

Resolve the repository root for git fetch/advance (including detached install.sh sparse checkouts) while snapshotting, building, and switching WorkingDirectory from apps/workbench when running from the LoopX monorepo.

Signed-off-by: maxliux5 <[email protected]>
…d-native-model-resume

Preserve native Codex history when the steward model changes
…goal-task-delivery-guidance-20261115

fix(collaboration): surface cross-goal delivery refusal
Keep ordinary Inbox reads transport-only. Carry the verified Turn key into the scoped DSH tool process and preserve peer dispositions, restart recovery and existing result receipts.

Signed-off-by: LoopX Agent <[email protected]>
…riginal-result-images-20261118

Send Turn-scoped local images in private Lark replies
… dead code (loopx-project#8985)

* fix(cli): repair CLI, host, Lark, and packaging contracts

Signed-off-by: aihop <[email protected]>

* fix(control-plane): harden host cleanup and retire unused paths

Signed-off-by: aihop <[email protected]>

* chore(repo): align repository URLs, CI paths, and lint

Signed-off-by: aihop <[email protected]>

---------

Signed-off-by: aihop <[email protected]>
Co-authored-by: aihop <[email protected]>
loopx-agent and others added 27 commits November 21, 2026 05:07
…vent queue kill on observation monitors (loopx-project#9155)

Signed-off-by: LoopX Agent <[email protected]>
…lities slice (Slice B1) (loopx-project#9154)

* fix(control-plane): stabilize v2.4.0 quota, turn-envelope, and capabilities slice

Signed-off-by: LoopX Agent <[email protected]>

* fix(quota): preserve tokenless identity and exact numeric types in attach_complete_turn_context

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>
…and stop receipt-unknown disk churn (loopx-project#9159)

Signed-off-by: LoopX Agent <[email protected]>
…ntime fixtures (loopx-project#9158)

* fix(control_plane): align lease recovery, settlement readback, and runtime fixtures

Signed-off-by: LoopX Agent <[email protected]>

* fix(control_plane): forward record_capture in worker outage test and harden version type guard

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>
…wording (loopx-project#9162)

* docs(release): reconcile final v2.4.0 stabilization PRs and boundary wording

Signed-off-by: LoopX Agent <[email protected]>

* docs(release): align loopx-project#9158 and loopx-project#9161 descriptions with verified commits

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>
Schedule an exact-head second review when the current model family lacks
qualified coverage and another family has a traceable review.

Keep the existing approval, dissent, CI and merge-readiness rules. Reuse the
review-history owner and the shared Reviewer declaration parser.

Signed-off-by: LoopX Agent <[email protected]>
…nd public guards (loopx-project#9080)

* fix(public-boundary): unify local path verdicts across presentation and guards

Refs loopx-project#5136.

Signed-off-by: ChengLong GU <[email protected]>

* fix(public-boundary): preserve directory roots and HTTP URL paths

Refs loopx-project#5136.

Signed-off-by: ChengLong GU <[email protected]>

* fix(public-boundary): treat home-directory URL paths as URL syntax

A home-directory name inside an ordinary http(s) URL is a URL path segment, the same as the /home/ links the presentation guard already keeps. Mask the URL for the /Users/ local-path arm in the Python classifier and the TypeScript Vision checkpoint, pin the row in the shared corpus, and stay raw on the publication tier.

Signed-off-by: ChengLong GU <[email protected]>

* fix(public-boundary): keep explicit path references out of URL masking

An explicit path: locator owns the token after it, so a value like path:/https://example.com/doc must stay visible to the local-path arm instead of being masked into path:/ plus spaces. Ordinary HTTP(S) links still mask and remain accepted. Refs loopx-project#5136.

Signed-off-by: ChengLong GU <[email protected]>

* test(public-boundary): register the URL corpus row in the tier differential

The ordinary_public_url_home_directory_segment row added by this PR is intentionally released by the internal-state tier while the publication tier keeps rejecting it as a remote location. Record it in the named release list and assert its category, so the differential matches the change it describes. Refs loopx-project#5136.

Signed-off-by: ChengLong GU <[email protected]>

---------

Signed-off-by: ChengLong GU <[email protected]>
* fix(update): roll back both archive runtime launchers

Signed-off-by: LoopX Agent <[email protected]>

* fix(update): recover archive launcher renames on interrupt

Signed-off-by: LoopX Agent <[email protected]>

* fix(update): preserve launchers changed during archive rollback

Signed-off-by: LoopX Agent <[email protected]>

* fix(update): preserve concurrent launchers during rollback recovery

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>
* Keep workspace repair candidate scopes on demand

Signed-off-by: LoopX Agent <[email protected]>

* Keep write scopes on demand before ordinary Todo selection

Signed-off-by: LoopX Agent <[email protected]>

* Keep requested write scopes on demand before a managed claim

Signed-off-by: LoopX Agent <[email protected]>

* Keep projected Todo candidates in the selection opening

Signed-off-by: huangruiteng <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>
Signed-off-by: huangruiteng <[email protected]>
Co-authored-by: huangruiteng <[email protected]>
Keep legacy hierarchy checks scoped to retired Agent declarations. Bind migration and host onboarding checks to their fixture runtime routes.

Signed-off-by: LoopX Agent <[email protected]>
…ect#8981)

* refactor(testing): use complete C1 source in host prompt qualification

Signed-off-by: LoopX Agent <[email protected]>

* docs: align release probe guidance with complete source input

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>
…ect#9118)

* fix: retain vision rearm source during successor settlement

Signed-off-by: LoopX Agent <[email protected]>

* fix: bound vision rearm source to original admission

Signed-off-by: LoopX Agent <[email protected]>

* test: distinguish missing goal source from empty todo display

Signed-off-by: LoopX Agent <[email protected]>

* fix: recover receipt-bound vision across same-second ACKs

Signed-off-by: LoopX Agent <[email protected]>

---------

Signed-off-by: LoopX Agent <[email protected]>
loopx-project#9142)

Signed-off-by: lusendong.6789 <[email protected]>
Signed-off-by: LoopX Agent <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: LoopX Agent <[email protected]>
Finder and launchd never load a user's interactive shell profile, so the
desktop App resolves its tools from a bounded search path. That search
covered Homebrew and `$HOME/.local/bin` but not nvm, which activates Node
by prepending `$NVM_BIN` to the interactive PATH. On a host whose only
supported Node is nvm-managed, the private installer therefore ran
`loopx doctor --deep --installation-only` without a Node on PATH, the
TypeScript runtime check failed, and the installer exited 1 — surfaced as
"安装程序退出(1);App 的启动环境未找到 Node.js" with `node_found: false`.

Resolve the same bounded nvm locations the Lark CLI resolver already uses,
without running nvm or sourcing any startup file: an `NVM_BIN` activated in
the App's own environment, then the recorded `default` alias chain
(`default` -> `lts/*` -> `lts/krypton` -> `v24.22.1`), then the installed
versions newest-first behind the supported Homebrew runtimes. The alias
read stays inside `$NVM_DIR/alias`, is depth-bounded and rejects
non-normal path components, so a missing, cyclic or malformed chain simply
falls through to installed-version discovery.

The installer and the App-owned services share this one search path, so the
same fix also covers the services the App starts afterwards.

Signed-off-by: Xiao Deshi <[email protected]>
@xiaods

xiaods commented Nov 21, 2026

Copy link
Copy Markdown
Owner Author

Validation evidence (head 4df48e7b7)

Pre-merge gate (standard tier, diff against main):

[loopx canary] premerge start: tier=standard changed_files=4 surfaces=docs_project_content, public_boundary
[loopx canary] premerge done: passed selected=17 failures=0
Gate Result
cargo test --lib 206 passed, 12 ignored (4 new nvm tests)
cargo fmt --check clean
cargo clippy --all-targets -- -D warnings clean
Windows cfg gating added block compiles with and without the unix cfg (rustc), so the Windows CI leg cannot regress
python3 -m unittest discover -s tests/desktop 28 passed
Real path (installed App's private release) loopx --format json doctor --deep --installation-only under the App's search path: before ok=false, detected_node_version=null, diagnostic_code=node_unavailable, exit 1; after the fix ok=true, detected_node_version=24.22.1, exit 0

Note: services::supervisor_tests::connected_runtime_requires_both_healthy_exact_identity_listeners is intermittently flaky (AddrInUse from ServiceEndpoints::allocate dropping its reservation between tests) on unmodified main as well — reproduced 1 failure in 5 base runs — so it is unrelated to this change.

@xiaods

xiaods commented Nov 21, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the canonical PR: loopx-project#9184 (same head 4df48e7, base loopx-project/loopx main). Closing here so the review queue has one entry.

@xiaods xiaods closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.